package org.ywf.agent.consumer;

import cn.hutool.core.date.DateUtil;
import cn.hutool.core.util.RandomUtil;
import org.springframework.stereotype.Component;
import org.ywf.agent.URLEnum;
import org.ywf.common.entity.RequestData;
import org.ywf.common.okhttp.OkHttpUtils;

import java.util.concurrent.TimeUnit;

/**
 * TODO
 *
 * @Author YWF
 * @Date 2023/1/31 17:58
 */
@Component
public class OneHttpConsumer extends AbstractAbcConsumer {
    @Override
    protected String dataCommit(String serviceCode, RequestData<?> requestData) {
        String rs = OkHttpUtils.builder().url(URLEnum.JOKE_URL.getHttpUrl())
                .addParam("key", URLEnum.JOKE_URL.getAuthKey())
                .addParam("sort", "asc")
                .addParam("time", String.valueOf(DateUtil.currentSeconds()))
                .addParam("page","1")
                .addParam("pagesize","10")
                .get()
                .sync();
        return rs;
    }
}
